package com.gary.heap;

import java.util.ArrayList;
import java.util.Random;

/**
 * @author peng_rui
 * @date 2022/2/23
 */
public class OOMTest {
    public static void main(String[] args) {
        ArrayList<Pic> list = new ArrayList<>();
        while (true) {
            try {
                Thread.sleep(20);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            list.add(new Pic(new Random().nextInt(1024*1024)));
        }
    }
}
class Pic {
    private byte[] bytes;

    public Pic(int len) {
        this.bytes = new byte[len];
    }
}
